package is.glif.fenius.webui.db;


import java.util.List;

import is.glif.fenius.webui.db.bean.Component;

import org.hibernate.Session;

public class ComponentDAO {
    
    public void create(Component resv) {
        Session session = HibernateSessionUtil.getSessionfactory().openSession(); 
        session.getTransaction().begin(); 
        session.save(resv);
        session.getTransaction().commit(); 

    }
    @SuppressWarnings("unchecked")
    public List<Component> findAll() { 
        Session session = HibernateSessionUtil.getSessionfactory().openSession(); 
        List<Component> list = (List<Component>) session.createQuery("from Component").list(); 
        
        return list;
    }
    
}
